home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 10
/
FM Towns Free Software Collection 10.iso
/
ms_dos
/
tool
/
fmlbp
/
page.awk
< prev
next >
Wrap
Text File
|
1994-07-20
|
1KB
|
71 lines
BEGIN {
t=(t)?t:8
l=(l)?l:54
hp=(hp)?hp:80
h=(h)?h:"70:20"
d=(d)?d:"90:24"
FS="\t"
fn=toupper(ARGV[1])
sub(/^.*\\/,"",fn)
print fn >"/dev/stderr"
hs=tostr(h)
ds=tostr(d)
"kiroku $20 $0d$0a" | getline dt
close("kiroku $20 $0d$0a")
print "FM Print File"
}
NF>1 {
s=$1
for(i=1; i<NF; i++) {
ns=t-length(s)%t
s=s sprintf("%" ns "s","") $(i+1)
}
$0=s
}
{
if(NR % l == 1) {
if(NR != 1) print ""
print hs
printf ("%" hp "s %-12s page %d\n", dt, fn, ++p)
print "EE" ds
}
print $0
print "E"
}
END {
print ""
printf("Page=%d\n",p) >"/dev/stderr"
}
function tostr(s) {
fs=cp=s
sub(/:[0-9]+$/,"",fs)
sub(/^[0-9]+:/,"",cp)
fsl=length(fs)
str="\x1c&"
for(i=1; i<fsl; i++) {
fsc=32+substr(fs,i,1)
str=str sprintf("%c",fsc)
}
fsc=96+substr(fs,fsl,1)
str=str sprintf("%c",fsc)
for(i=1; i<fsl; i++) {
fsc=32+substr(fs,i,1)
str=str sprintf("%c",fsc)
}
fsc=112+substr(fs,fsl,1)
str=str sprintf("%c",fsc)
cpl=length(cp)
str=str "\x1c$"
for(i=1; i<cpl; i++) {
cpc=32+substr(cp,i,1)
str=str sprintf("%c",cpc)
}
cpc=112+substr(cp,cpl,1)
str=str sprintf("%c",cpc)
return str
}